<?php
/**
 * Celebrio Core
 * 
 * @copyright  Copyright (c) 2011 Celebrio Software
 * @package    Celebrio
 * @subpackage Core
 */
namespace Celebrio\Core;

/**
 * The interface every module initializing/installing class must implement.
 * 
 * 
 * @author pavel
 */
interface IModuleInit {
    
    /**
     * Installs the module (loads it to the system for the first time).
     */
    public function install(array $configuration);

    /**
     * Uninstalls the module. This method should remove all the stuff
     * created by the install method or upgrade method, for example DB tables.
     *
     * @abstract
     * @return void
     */
    public function uninstall();
    
    
    /**
     * Upgrades the module to the latest version. 
     */
    public function upgrade();
    
    /**
     * Activates the module each time we require its functionality.
     * For example, we can connect DB module to the database or lock
     * the resources the module requires exclusively.
     */
    public function init(array $configuration);
    
    /**
     * Checks whether the module can be installed (PHP extension loaded
     * or another non-module restriction).
     */
    public function isAvailable();
    
    /**
     * The form displayed while activation process is generated according
     * to the array returned by this method.
     * 
     * @return array(
     *             array(string => string)
     *         )
     */
    public function formFields();
    
    /**
     * You can change the configuration before it's saved
     * or used.
     */
    public function changeConfig(array $configuration);
    
    public function upgradeConfig(array $configuration);
}

